#include <bits/stdc++.h>
using namespace std;

const int COLOR = 6, N = 15;
bool poker[COLOR][N];
int get_color(char c)
{
	switch (c)
	{
	case 'D':
		return 1;
	case 'C':
		return 2;
	case 'H':
		return 3;
	default:
		return 4;
	}
}
int get_number(char c)
{
	if (c == 'A')
	{
		return 1;
	}
	else if (c >= '2' && c <= '9')
	{
		return c - '0';
	}
	else if (c == 'T')
	{
		return 10;
	}
	else if (c == 'J')
	{
		return 11;
	}
	else if (c == 'Q')
	{
		return 12;
	}
	else
	{
		return 13;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n, i, j;
	char c1, c2;
	cin >> n;
	for (i = 1; i <= n; ++i)
	{
		cin >> c1 >> c2;
		poker[get_color(c1)][get_number(c2)] = true;
	}
	int ans = 0;
	for (i = 1; i <= 4; ++i)
	{
		for (j = 1; j <= 13; ++j)
		{
			if (!poker[i][j])
			{
				++ans;
			}
		}
	}
	cout << ans;
	return 0;
}
